package com.javalong.affairs.module.notifything.activity;

import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;

import com.javalong.affairs.R;
import com.javalong.affairs.base.activity.UIHandlerActivity;
import com.javalong.affairs.base.ui.TopTitle;
import com.javalong.affairs.base.ui.TopTitle.OnLeftDrawableClick;

public class ImageActivity extends UIHandlerActivity {

	private ImageView iv_image;
	private TopTitle topTitle;

	public static void toThisActivity(Context context, String image) {
		Intent intent = new Intent(context, ImageActivity.class);
		intent.putExtra("image", image);
		context.startActivity(intent);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_image);
		iv_image = (ImageView) findViewById(R.id.iv_image);
		topTitle = (TopTitle) findViewById(R.id.ui_toptitle);
		topTitle.setOnLeftDrawableClick(new OnLeftDrawableClick() {

			@Override
			public void leftClick() {
				finish();
			}
		});
		initData();
	}

	private void initData() {
		String imgPath = getIntent().getStringExtra("image");
		iv_image.setImageBitmap(BitmapFactory.decodeFile(imgPath));
	}

}
